﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MyControls_NewQuestion : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            if (ddlQuestionType.SelectedIndex == 0)
            {
                mvwAnswerContent.ActiveViewIndex = -1;
            }
            else if (ddlQuestionType.SelectedIndex == 1)
            {
                mvwAnswerContent.SetActiveView(vwTextBox);
            }
            else if (ddlQuestionType.SelectedIndex == 2)
            {
                mvwAnswerContent.SetActiveView(vwCheckBox);
            }
            else if (ddlQuestionType.SelectedIndex == 3)
            {
                mvwAnswerContent.SetActiveView(vwRadioButton);
            }
        }
        
    }
    public TextBox QuestionContent { get; set; }
    public Label QuestionNumber { get; set; }
    public MultiView AnswerContent { get; set; }
    public View AnswerTextbox { get; set; }
    public View AnswerCheckbox { get; set; }
    public View AnswerRadio { get; set; }
    public DropDownList QuestionType { get; set; }

    protected void ddlQuestionType_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlQuestionType.SelectedIndex == 0)
        {
            mvwAnswerContent.ActiveViewIndex = -1;
        }
        else if (ddlQuestionType.SelectedIndex == 1)
        {
            mvwAnswerContent.SetActiveView(vwTextBox);
        }
        else if (ddlQuestionType.SelectedIndex == 2)
        {
            mvwAnswerContent.SetActiveView(vwCheckBox);
        }
        else if (ddlQuestionType.SelectedIndex == 3)
        {
            mvwAnswerContent.SetActiveView(vwRadioButton);
        }
    }
}